/*
 * @Description: 客情维护节点配置
 * @Date: 2023-08-28 15:40:24
 * @FilePath: \hksj-vued:\03code\hk-iot\src\api\system\dateNodeConfig\index.ts
 */
import axiosRequest from '/@/utils/request';

/**
 * 客情维护节点配置接口
 * @method createCustomerMaintenanceConfiguration 新增客情维护配置
 * @method deleteCustomerMaintenanceConfiguration 删除客情维护配置
 * @method updateCustomerMaintenanceConfiguration 修改客情维护配置
 * @method queryCustomerMaintenanceConfigurationById 根据id查询客情维护配置
 * @method queryCustomerMaintenanceConfigurationByYear 根据年份查询客情维护配置
 */
export function useDateNodeConfigApi() {
  return {
    // 新增客情维护配置
    createCustomerMaintenanceConfiguration: async (params: object) => {
      const res = await axiosRequest({
        url: '/api/customerMaintenanceConfiguration/createCustomerMaintenanceConfiguration',
        method: 'post',
        data: params,
      });
      return res;
    },
    // 删除客情维护配置
    deleteCustomerMaintenanceConfiguration: async (id: string) => {
      const res = await axiosRequest({
        url: `/api/customerMaintenanceConfiguration/deleteCustomerMaintenanceConfiguration/${id}`,
        method: 'delete',
        data: id,
        headers: { stringify: true }
      });
      return res;
    },
    // 修改客情维护配置
    updateCustomerMaintenanceConfiguration: async (params: {
      "id": string,
      "holidayId": string,
      "holidayName": string,
      "maintenanceTime": string,
      "advanceNoticeDay": string | number,
      "seq": string | number
    }) => {
      const res = await axiosRequest({
        url: `/api/customerMaintenanceConfiguration/updateCustomerMaintenanceConfiguration`,
        method: 'put',
        data: params,
      });
      return res;
    },
    // 根据id查询客情维护配置
    queryCustomerMaintenanceConfigurationById: async (params: { 'id': string }) => {
      const res = await axiosRequest({
        url: `/api/customerMaintenanceConfiguration/queryCustomerMaintenanceConfigurationById/${params.id}`,
        method: 'get',
        data: params,
      });
      return res;
    },
    // 根据年份查询客情维护配置
    queryCustomerMaintenanceConfigurationByYear: async (params: { 'year': string | number }) => {
      const res = await axiosRequest({
        url: '/api/customerMaintenanceConfiguration/queryCustomerMaintenanceConfigurationByYear',
        method: 'post',
        data: params,
        headers: { stringify: true }
      });
      return res;
    },
  };
}
